home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / term / extras / source / term-source.lha / Start.c < prev    next >
C/C++ Source or Header  |  1995-07-09  |  3KB  |  125 lines

  1. /*
  2. **    Start.c
  3. **
  4. **    The program entry point
  5. **
  6. **    Copyright © 1990-1995 by Olaf `Olsen' Barthel
  7. **        All Rights Reserved
  8. */
  9.  
  10. #include <intuition/intuitionbase.h>
  11. #include <workbench/workbench.h>
  12. #include <exec/execbase.h>
  13. #include <dos/dosextens.h>
  14.  
  15. #include <clib/intuition_protos.h>
  16. #include <clib/exec_protos.h>
  17. #include <clib/dos_protos.h>
  18.  
  19. #include <pragmas/intuition_pragmas.h>
  20. #include <pragmas/exec_pragmas.h>
  21. #include <pragmas/dos_pragmas.h>
  22.  
  23.     /* Standard topaz.font/8. */
  24.  
  25. extern struct TextAttr     DefaultFont;
  26.  
  27.     /* exec.library base pointer. */
  28.  
  29. extern struct ExecBase    *SysBase;
  30.  
  31.     /* The approriate machine type check. */
  32.  
  33. #ifdef _M68030
  34. #define MACHINE_OKAY (SysBase -> AttnFlags & AFF_68020)
  35. #else
  36. #define MACHINE_OKAY (1)
  37. #endif    /* _M68030 */
  38.  
  39.     /* Start():
  40.      *
  41.      *    Program entry point, checks for the right CPU type and
  42.      *    runs the main program if possible.
  43.      */
  44.  
  45. LONG __saveds
  46. Start(VOID)
  47. {
  48.         /* Get SysBase. */
  49.  
  50.     SysBase = *(struct ExecBase **)4;
  51.  
  52.         /* Is the minimum required processor type and Kickstart 2.04 (or higher)
  53.          * available?
  54.          */
  55.  
  56.     if(MACHINE_OKAY && (SysBase -> LibNode . lib_Version > 37 || (SysBase -> LibNode . lib_Version == 37 && SysBase -> SoftVer >= 175)))
  57.         return(main());
  58.     else
  59.     {
  60.         register struct Process *ThisProcess = (struct Process *)SysBase -> ThisTask;
  61.  
  62.             /* Is a Shell window available? */
  63.  
  64.         if(ThisProcess -> pr_CLI)
  65.         {
  66.             register struct DosLibrary *DOSBase;
  67.  
  68.                 /* Show the message. */
  69.  
  70.             if(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",0))
  71.             {
  72.                 if(MACHINE_OKAY)
  73.                     Write(ThisProcess -> pr_COS,"Kickstart 2.04 or higher required.\a\n",36);
  74.                 else
  75.                     Write(ThisProcess -> pr_COS,"MC68020 or higher required.\a\n",29);
  76.  
  77.                 CloseLibrary(DOSBase);
  78.             }
  79.  
  80.             return(RETURN_FAIL);
  81.         }
  82.         else
  83.         {
  84.             register struct IntuitionBase    *IntuitionBase;
  85.             register struct WBStartup    *WBenchMsg;
  86.  
  87.                 /* Wait for startup message. */
  88.  
  89.             WaitPort(&ThisProcess -> pr_MsgPort);
  90.  
  91.                 /* Get the message. */
  92.  
  93.             WBenchMsg = (struct WBStartup *)GetMsg(&ThisProcess -> pr_MsgPort);
  94.  
  95.                 /* Show the message. */
  96.  
  97.             if(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0))
  98.             {
  99.                 STATIC struct IntuiText SorryText = {0,1,JAM1,6,3,&DefaultFont,(UBYTE *)"Sorry",NULL};
  100.  
  101.                 if(MACHINE_OKAY)
  102.                 {
  103.                     STATIC struct IntuiText BodyText = {0,1,JAM1,5,3,&DefaultFont,(STRPTR)"Kickstart 2.04 or higher required.",NULL};
  104.  
  105.                     AutoRequest(NULL,&BodyText,NULL,&SorryText,NULL,NULL,309,46);
  106.                 }
  107.                 else
  108.                 {
  109.                     STATIC struct IntuiText BodyText = {0,1,JAM1,5,3,&DefaultFont,(UBYTE *)"MC68020 or higher required.",NULL};
  110.  
  111.                     AutoRequest(NULL,&BodyText,NULL,&SorryText,NULL,NULL,253,46);
  112.                 }
  113.  
  114.                 CloseLibrary(IntuitionBase);
  115.             }
  116.  
  117.                 /* Return the startup message and exit. */
  118.  
  119.             Forbid();
  120.  
  121.             ReplyMsg((struct Message *)WBenchMsg);
  122.         }
  123.     }
  124. }
  125.